-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safer wrapping for FFI clients. #2906
base: main
Are you sure you want to change the base?
Conversation
f0dd565
to
47b8318
Compare
@Yury-Fridlyand @jonathanl-bq does this require more changes? |
I'm still lacking rust knowledge to assess. Summoning @ikolomi to give a bless. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the one documentation suggestion, looks good to me.
the test failures in go integration tests (but not in unit tests) mean there's a chance that the clients are being released while still in usage. |
@nihohit Can you open an issue describing it, and we will assign someone? |
Use `Arc` instead of `Box` to wrap the `ClientAdapter`, so that the lifetime of the adapter will be extended even in cases where the client is closed during commands. This also saves on using `as usize` conversions to the pointer, which cause provenance to be lost and might lead to undefined behavior. Signed-off-by: Shachar Langbeheim <[email protected]>
@avifenesh done |
Use
Arc
instead ofBox
to wrap theClientAdapter
, so that the lifetime of the adapter will be extended even in cases where the client is closed during commands. This also saves on usingas usize
conversions to the pointer, which cause provenance to be lost and might lead to undefined behavior.The memory cost of this change is increasing the allocation of the client by one pointer size, and the runtime cost is 4 atomic increments/decrements per command.
Checklist
Before submitting the PR make sure the following are checked: